Only convert user and group names to lowercase in API methods#1125
Merged
Only convert user and group names to lowercase in API methods#1125
Conversation
3v1n0
approved these changes
Nov 17, 2025
| // authd uses lowercase user and group names | ||
| uInfo.Name = strings.ToLower(uInfo.Name) | ||
| for i, g := range uInfo.Groups { | ||
| uInfo.Groups[i].Name = strings.ToLower(g.Name) |
Contributor
There was a problem hiding this comment.
This part is already tested?
Contributor
Author
There was a problem hiding this comment.
Remove leftover golden files from tests that don't exist anymore by
running
git rm -r internal/**/testdata/golden
TESTS_UPDATE_GOLDEN=1 go test ./internal/...
We use underscores instead of spaces in test names.
Immediately convert username to lowercase, for consistency with how it's done in the other methods.
We use underscores instead of spaces in test names.
For consistency with the other *_with_uppercase test cases.
The tests change DB content, so we should also check the result.
We now only convert user and group names to lowercase in public API methods. In all other functions, we assume that the names are already in lowercase, to avoid repeatedly converting the same name to lowercase in each layer of our code.
6de67e4 to
8066a69
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1125 +/- ##
==========================================
- Coverage 87.79% 87.78% -0.01%
==========================================
Files 89 89
Lines 6151 6150 -1
Branches 111 111
==========================================
- Hits 5400 5399 -1
Misses 695 695
Partials 56 56 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As discussed in #1082 (comment), we now only convert user and group names to lowercase in public API methods. In all other functions, we assume that the names are already in lowercase, to avoid repeatedly converting the same name to lowercase in each layer of our code.